import base from './base';
import axios from './http';
const apiUrl = base.test;
// 获取省份列表
function getPList (pageNo, pageSize) {
    return axios.get(`${apiUrl}/nu/client/area/province?currentPage=${pageNo}&pageSize=${pageSize}`);
};
// 获取市列表
function getCList (parentCode, pageNo, pageSize) {
  return axios.get(`${apiUrl}/nu/client/area/city/${parentCode}?currentPage=${pageNo}&pageSize=${pageSize}`);
}
// 获取区列表
function getDList (parentCode, pageNo, pageSize) {
  return axios.get(`${apiUrl}/nu/client/area/county/${parentCode}?currentPage=${pageNo}&pageSize=${pageSize}`);
}
// 添加/编辑地址
function addAddress (param) {
  return axios.post(`${apiUrl}/nu/client/customer/address/edit`, param);
}
// 获取地址详情
function getAddress (addressId) {
  return axios.get(`${apiUrl}/nu/client/customer/address/detail?addressId=${addressId}`);
}
// 删除地址
function delAddress (addressId) {
  return axios.get(`${apiUrl}/nu/client/customer/address/delete?addressId=${addressId}`);
}
// 获取所有地址列表
function getAllAddress () {
  return axios.get(`${apiUrl}/nu/client/customer/address/list`);
}
//设定默认地址
function setAddressDefault (addressId) {
  return axios.get(`${apiUrl}/nu/client/customer/address/setDefault?addressId=${addressId}`);
}
//获取用户的默认地址
function getAddressDefault () {
  return axios.get(`${apiUrl}/nu/client/customer/address/getDefault`);
}

export {
  getPList,getCList,getDList,addAddress,getAddressDefault,setAddressDefault,getAllAddress,delAddress,getAddress
}